package com.dstz.form.manager.impl;

import java.util.Arrays;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dstz.base.api.constant.Direction;
import com.dstz.base.api.query.QueryFilter;
import com.dstz.base.api.query.QueryOP;
import com.dstz.base.db.model.query.DefaultPage;
import com.dstz.base.db.model.query.DefaultQueryFilter;
import com.dstz.base.manager.impl.BaseManager;
import com.dstz.form.dao.FormCustSqlFieldsDao;
import com.dstz.form.manager.FormCustSqlFieldsManager;
import com.dstz.form.model.custsql.FormCustSqlFields;

/**
 * @description:自定义列表字段 的ManagerImpl
 * @company:宇宙大魔王
 * @author:xianggang
 * @date:2019-08-31 17:48:32
 */
@Service("formCustSqlFieldsManager")
public class FormCustSqlFieldsManagerImpl extends BaseManager<String, FormCustSqlFields>
        implements FormCustSqlFieldsManager {
	
	@Resource
	FormCustSqlFieldsDao formCustSqlFieldsDao;
	
	/**
	 * 根据sqlId获取字段列表
	 * @param id
	 * @return
	 * @return List<FormCustSqlFields>
	 * @author xianggang
	 * @date 2019年8月31日 下午10:35:18
	 */
	@Override
	public List<FormCustSqlFields> getListBySqlId(String id) {
		QueryFilter queryFilter = new DefaultQueryFilter();
		queryFilter.addFilter("sql_id_", Arrays.asList(id.split(",")), QueryOP.IN);
		DefaultPage page = new DefaultPage();
		page.setPage(1);
		page.setLimit(Integer.MAX_VALUE);
		queryFilter.setPage(page);
		queryFilter.addFieldSort("sn_", Direction.ASC.getKey());
		return query(queryFilter);
	}
	
}
